| 1. | While writes to volatile variables are guaranteed to be immediately visible to other threads , there is no way to render a read - modify - write sequence of operations atomic , meaning , for example , that a volatile variable cannot be used to reliably implement a mutex mutual exclusion lock or a counter 虽然可以保证其他变量可以立即看到对可变变量的写入,但无法呈现原子操作的读-修改-写顺序,这意味着(比如说)可变变量无法用来可靠地实现互斥(互斥锁定)或计数器。 |